// Kademlia 协议包括四种远程 RPC 操作：PING、STORE、FIND_NODE、FIND_VALUE。
namespace java cool.taomu.toolkit.kademlia.thrift

struct Node{
	1:string id,
	2:string host,
	3:i32 port,
	4:i32 offline,
	5:i64 timestamp
}

struct Response{
	1:list<Node> nodes;
	2:string result;
	3:i32 status;
	4:string message;
}

struct ServiceEntity{
	1: string serviceName,
    2: string method,
    3: string contentType,
    4: map<string, string> params,
    5: map<string, string> headers,
    6: string body,
    7: string cookie
}


service KademliaService {
	Response ping(1:Node node)
	Response findService(1:ServiceEntity message)
	Response findServiceAndNode(1:ServiceEntity message,2:Node node)
	void store(1:string key,2:string value)
	Response findNode(1:string nodeId)
	Response findNodeAndNode(1:string nodeId,2:Node node)
	Response findValue(1:string key)
	Response findValueAndNode(1:string key,2:Node node)
}